<!DOCTYPE html>
<html lang="zh_CN">
<head>
    <#assign currentMenu="sceneIntroduce"/>
    <#include "../common/header.ftl">
    <script src="/js/plugins/jquery-bootstrap/jquery.bootstrap.min.js"></script>
    <script src="/js/My97DatePicker/WdatePicker.js"></script>
    <style type="text/css">
        .modal-body {
            max-height: 750px;
            overflow-y: auto;
        }

        .modal-body img {
            width: 100%;
        }
    </style>
</head>
<body>


<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl">
    <div class="row">
        <div class="col-lg-3">
            <#include "../common/menu.ftl">
        </div>
        <div class="col-lg-9">
            <div class="row">
                <div class="col-lg-12">
                    <h1 class="page-head-line">景点介绍管理</h1>
                </div>
            </div>
        <#--高级查询--->
            <form class="form-inline" id="searchForm" action="/sceneIntroduce/list.do" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <div class="form-group">
                    <label>关键字:</label>
                    <input type="text" class="form-control" name="keyword" value="${(qo.keyword)!}"
                           placeholder="请输入景点名称">
                </div>
                <div class="form-group">
                    <label>景区级别:</label>
                    <select class="form-control" name="level">
                        <option value="-1">全部</option>
                        <option value="0">A级景区</option>
                        <option value="1">AA级景区</option>
                        <option value="2">AAA级景区</option>
                        <option value="3">AAAA级景区</option>
                        <option value="4">AAAAA级景区</option>
                    </select>
                </div>
                <script type="text/javascript">
                    $("#searchForm select[name='level']").val(${qo.level});
                </script>
                <button id="btn_query" class="btn btn-info">
                    <span class="glyphicon glyphicon-search"></span> 查询
                </button>
                <a role="button" class="btn btn-success inputBtn">
                    <span class="glyphicon glyphicon-plus"></span> 新增
                </a>
            </form>

            <table class="table table-striped table-hover">
                <tr>
                    <th>序号</th>
                    <th>景点图片</th>
                    <th>景点标题</th>
                    <th>景点地址</th>
                    <th>景点名称</th>
                    <th>景点级别</th>
                    <th>操作</th>
                </tr>
                <#list pageInfo.list as entity>
                    <tr>
                        <td>${entity_index + 1}</td>
                        <td><img src="${entity.imgUrl}" width="100"/></td>
                        <td>${entity.commend.title}</td>
                        <td>${entity.address}</td>
                        <td>${entity.name}</td>
                        <td>${entity.levelName}</td>
                        <td>
                            <a role="button" class="btn btn-warning btn-xs inputBtn" data-json='${entity.json}'>
                                <span class="glyphicon glyphicon-pencil"></span> 修改
                            </a>
                        </td>
                    </tr>
                </#list>
            </table>
            <#include "../common/page.ftl">
        </div>
    </div>
</div>

<#-- 修改推荐游记 -->
<div id="inputModal" class="modal" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">景点内容</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/sceneIntroduce/saveOrUpdate.do" method="post"
                      enctype="multipart/form-data" id="editForm">
                    <input type="hidden" name="id"/>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">景点图片：</label>
                        <div class="col-lg-6">
                            <img id="imgUrl" style="width: 100%"/>
                            <input type="file" class="form-control" name="img"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">景点标题：</label>
                        <div class="col-lg-6">
                            <select class="form-control" name="commend.id">
                                <#list commends as c>
                                    <option value="${c.id}">${c.title}</option>
                                </#list>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">景点地址：</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control" name="address"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">景点名称：</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control" name="name"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">景点级别：</label>
                        <div class="col-lg-6">
                            <select class="form-control" name="level">
                                <option value="0">A级景区</option>
                                <option value="1">AA级景区</option>
                                <option value="2">AAA级景区</option>
                                <option value="3">AAAA级景区</option>
                                <option value="4">AAAAA级景区</option>
                            </select>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary submitBtn">保存</button>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(function () {
        //弹出设置推荐的模态框
        $(".inputBtn").click(function () {
            /* var json = $(this).data("json");
             //回显数据: 标题/封面/当前数据的id
             $("#editForm input[name='id']").val(json.id);
             $("#editForm input[name='name']").val(json.name);
             $("#editForm input[name='title']").val(json.title);
             $("#editForm input[name='coverUrl']").val(json.coverUrl);
             $("#editForm input[name='schedule']").val(json.schedule);
             $("#editForm select[name='type']").val(json.type);
             $("#coverUrl").attr("src", json.coverUrl);
             //显示模态框*/
            $("#inputModal").modal("show");
        });

        $(".submitBtn").click(function () {
            $("#editForm").submit();
        });
    });
</script>
</body>
</html>